﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using L = Science.Mathematics.LinearAlgebra;

namespace Strang3Ed.Chapter02.Section4
{
    public class Example03
    {
        public Example03()
        {
        }
        private string result;
        public string Result
        {
            get { return result; }
        }
        public void Compute()
        {
            L.Matrix[,] a = new L.Matrix[1, 2];
            double[,] x = {{1.0},
                           {1.0}};
            a[0,0] = new L.Matrix(x);
            double[,] x1 = {{4.0},
                            {5.0}};
            a[0, 1] = new L.Matrix(x1);

            L.Matrix[,] b = new L.Matrix[2, 1];
            double[,] x2 = {{3.0, 2.0}};
            b[0, 0] = new L.Matrix(x2);
            double[,] x3 = {{1.0, 0.0}};
            b[1, 0] = new L.Matrix(x3);

            L.BlockMatrix A = new L.BlockMatrix(a);
            L.BlockMatrix B = new L.BlockMatrix(b);
            L.Matrix AB = A * B;

            result += AB[0, 0].ToString() + "    ";
            result += AB[0, 1].ToString() + "\r\n";

            result += AB[1, 0].ToString() + "    ";
            result += AB[1, 1].ToString() + "\r\n";
        }
    }
}
/*
7    2
8    2
*/



